<%@page import="org.quickbundle.project.RmProjectHelper"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@page import="java.util.List"%>
<%@page import="org.quickbundle.tools.helper.RmJspHelper"%>
<%@page import="org.quickbundle.project.RmGlobalReference"%>
<%@ page import="org.quickbundle.tools.helper.RmVoHelper" %>
<%@ page import="org.quickbundle.orgauth.rmfunctionnode.vo.RmFunctionNodeVo" %>
<%@ page import="org.quickbundle.orgauth.rmfunctionnode.util.IRmFunctionNodeConstants" %>
<%@page import="org.quickbundle.project.common.vo.RmCommonVo"%>
<%@page import="org.quickbundle.tools.helper.RmStringHelper"%>
<%@page import="org.quickbundle.config.RmConfig"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<%-- <%@ include file="/jsp/include/rmGlobal.jsp" %>
<%@ include file="/jsp/include/rmGlobal_insert.jsp" %> --%>
<%@ taglib uri="/dfhc" prefix="dfhc" %>
<!-- 全局js 和css包 -->
<%@ include file="/jsp/include/web/new/global.jsp" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title><bean:message key="qb.web_title"/></title>
<script type="text/javascript">
</script>
</head>
<body>

<form name="form"  id="form" method="post">
<article class="page-container">

	<form action="" method="post" class="form form-horizontal" id="form-member-add searchForm" >
		<input type="hidden" id="id" name="id" value="${bean.id}">
		<dfhc:div templateId="h_ui_div_row_cl">
	    <dfhc:title templateId="h_ui_label_title"><%=IRmFunctionNodeConstants.TABLE_COLUMN_CHINESE.get("node_type")%>:</dfhc:title>	    
	    <dfhc:div templateId="h_ui_div_fromcontrol">	        
			<dfhc:select templateId="h_ui_select" size="1" name="node_type" id="node_type" pleaseSelect="1" defaultValue="${bean.node_type}" sqlOption="code" code="<%=IRmFunctionNodeConstants.DICTIONARY_RM_FUNCTION_NODE_TYPE%>"  />
		</dfhc:div>	    		 
	    </dfhc:div>
	    <br />
	    <dfhc:div templateId="h_ui_div_row_cl">
	    <dfhc:title templateId="h_ui_label_title"><%=IRmFunctionNodeConstants.TABLE_COLUMN_CHINESE.get("node_type")%>:</dfhc:title>	    
	    <dfhc:div templateId="h_ui_div_fromcontrol">	        
			<dfhc:select templateId="h_ui_select" size="1" name="function_property" id="function_property" pleaseSelect="1" defaultValue="${bean.function_property}" sqlOption="code" code="<%=IRmFunctionNodeConstants.DICTIONARY_FUNCTION_PROPERTY%>"  />
		</dfhc:div>	    		 
	    </dfhc:div>
	    <br />
	    <dfhc:div templateId="h_ui_div_row_cl">
	    <dfhc:title templateId="h_ui_label_title"><%=IRmFunctionNodeConstants.TABLE_COLUMN_CHINESE.get("name")%>:</dfhc:title>	    
	    <dfhc:div templateId="h_ui_div_fromcontrol">	        
			<dfhc:input templateId="h_ui_input" value="${bean.name}" id="name" name="name"/>			
		</dfhc:div>	    		 
	    </dfhc:div>
	    <br />
		<dfhc:div templateId="h_ui_div_row_cl">
			<dfhc:title templateId="h_ui_label_title"><%=IRmFunctionNodeConstants.TABLE_COLUMN_CHINESE.get("enable_status")%>:</dfhc:title>
			<dfhc:div templateId="h_ui_div_fromcontrol">
				<dfhc:select templateId="h_ui_select" size="1" name="enable_status" id="enable_status" pleaseSelect="1" defaultValue="${bean.enable_status}" sqlOption="code" code="<%=IRmFunctionNodeConstants.DICTIONARY_RM_LOCK_STATUS%>"  />				
			</dfhc:div>
		</dfhc:div>
		<br />
		<dfhc:div templateId="h_ui_div_row_cl">
			<dfhc:title templateId="h_ui_label_title"><%=IRmFunctionNodeConstants.TABLE_COLUMN_CHINESE.get("total_code")%>:</dfhc:title>
			<dfhc:div templateId="h_ui_div_fromcontrol">
				<dfhc:input templateId="h_ui_input" value="${bean.total_code}"  id="total_code" name="total_code"/>
			</dfhc:div>
		</dfhc:div>
		<br />
		<dfhc:div templateId="h_ui_div_row_cl">
			<dfhc:title templateId="h_ui_label_title"><%=IRmFunctionNodeConstants.TABLE_COLUMN_CHINESE.get("order_code")%>:</dfhc:title>
			<dfhc:div templateId="h_ui_div_fromcontrol">
				<dfhc:input templateId="h_ui_input" value="${bean.order_code}"  id="order_code" name="order_code"/>
			</dfhc:div>
		</dfhc:div>
		<br />
		<dfhc:div templateId="h_ui_div_row_cl">
			<dfhc:title templateId="h_ui_label_title"><%=IRmFunctionNodeConstants.TABLE_COLUMN_CHINESE.get("description")%>:</dfhc:title>
			<dfhc:div templateId="h_ui_div_fromcontrol">
				<dfhc:textarea templateId="h_ui_textarea" value="${bean.description}" id="description"  name="description" cols="" rows="" maxlength="100" ></dfhc:textarea>
			</dfhc:div>
		</dfhc:div>
		<br />
		<dfhc:div templateId="h_ui_div_row_cl">
			<dfhc:title templateId="h_ui_label_title"><%=IRmFunctionNodeConstants.TABLE_COLUMN_CHINESE.get("data_value")%>:</dfhc:title>
			<dfhc:div templateId="h_ui_div_fromcontrol">				
				<dfhc:input templateId="h_ui_input" value="${bean.data_value}" id="data_value" name="data_value"/>
			</dfhc:div>
		</dfhc:div>
		<br />
		
		<dfhc:div templateId="h_ui_div_row_cl">
			<dfhc:span templateId="h_ui_button_span">
		         <dfhc:button templateId="h_ui_achieve_button" onclick="achieve()" />
				 <dfhc:button templateId="h_ui_export_button" onclick="exportToHX()" />
				 <dfhc:button templateId="h_ui_sava_button" onclick="sava()" />
				 <dfhc:button templateId="h_ui_cancel_button" onclick="javascript:history.go(-1)" />
				 <dfhc:button templateId="h_ui_reset_button"  onclick="javascript:_reset('#searchForm');" />
			</dfhc:span>
		</dfhc:div>
	</form>
</article>

</form>

</body>
</html>
<script type="text/javascript">
//重置
function _reset(obj) {
	$('#node_type').val("");
	$('#function_property').val("");
	$('#name').val("");
	$('#enable_status').val("");
	$('#total_code').val("");
	$('#order_code').val("");
	$('#description').val("");
	$('#data_value').val("");
	$(obj).find("input").each(function() {
				if(!$(this).is(":hidden")){
					$(this).val("");
				}
			});
	$(obj).find("select").each(function() {
				$(this).val("");
			});
	$(obj).find("textarea").each(function() {
		$(this).val("");
	});
}
function achieve(){
	var menuUrl=$('#data_value').val();
	if(menuUrl==""||menuUrl.length==0){
		alert("请先输入URL值");
		return false;
	}
	$.ajax({
		type:"post",
		url:"<%=request.getContextPath()%>/rmFunctionNode/dealWithUrl?menuUrl="+menuUrl,
		async:false,
		success:function(response){
			 var html_string='';
			 var objname='';
			 response = typeof response === 'string' ? $.parseJSON(response ) : response;
			  $.each(response,function(idx,obj){
			    html_string +=  '<input type="checkbox" name="names" value="'+obj+'"/><input size="50" type="text" value="'+obj+'"/><br/>';
			 });
			 $(".function_link").html(html_string);
		}
	});
}
function exportToHX(){
	var  jspPath = prompt("请输入扫描的jsp目录:","${jspRootPath}");
	if (jspPath == null){
	  return false;		 
	}
	$.ajax({
		type:"post",
		url:"<%=request.getContextPath()%>/rmFunctionNode/importFunctionLink&jspPath="+jspPath+"&total_Code="+form.total_code.value,
		async:false,
		success:function(response){
			 var html_string='';
			 var objname='';
			 response = typeof response === 'string' ? $.parseJSON(response ) : response;
			  $.each(response,function(idx,obj){
			    html_string +=  '<input type="checkbox" name="names" value="'+obj+'"/><input size="50" type="text" value="'+obj+'"/><br/>';
			 });
			 $(".function_link").html(html_string);
		},
		error : function(xhr, s1, s2) {
		var message = xhr.responseText;
		eval("var json = " + message);
		if ($.trim(json.exception).length == 0) {
			alert('数据异常,请刷新页面重试');
		} else {
			alert(json.exception);
		}
	}
	});
}
function sava(url,id){
	var list="${empty bean}";
	if(list != "false" ){
		var menuUrl=$("#data_value").val();
		form.action="<%=request.getContextPath()%>/rmFunctionNode/insert&menuUrl="+menuUrl;
    	form.target="_parent";
	    form.submit();
	}else{
		var id= '${bean.id}';
		var newurl = "<%=request.getContextPath()%>/rmFunctionNode/update" +"?id=" + id;
		layer.confirm('确认要修改吗？', function(index) {
			form.action=newurl;
			form.target="_parent";
			form.submit();
		});
		
	}
}
</script>